package controller;

import interfaces.MainFrame;

import java.rmi.RemoteException;
import java.util.List;

import model.UserDataWrapper;
import services.UserData;
import services.UserDataServicesProxy;

import com.google.common.collect.Lists;

public class DataEditorController {
	public DataEditorController() {
	}
	
	
	public List<UserDataWrapper> getData() {
		Object[] data = null;
		try {
			data = new UserDataServicesProxy().getData(MainFrame.getUser());
		} catch (RemoteException e) {
			e.printStackTrace();
		}
		List<UserDataWrapper> list = Lists.newArrayList();
		if(data == null)
			return list;
		for(Object obj : data) {
			UserData d = (UserData) obj;
			list.add(UserDataWrapper.wrap(d));
		}
		return list;
	}
}
